import { createBrowserRouter, Navigate } from "react-router-dom";
import Main from "@/layouts/Main";
import Layout from "@/layouts/Index";
import Home from "@/pages/home";
import Earn from "@/pages/earn";
import Pk from "@/pages/pk";
import Task from "@/pages/task";
import Nft from "@/pages/nft";

import EarnRecord from "@/pages/earn/record";

import PkRoom from "@/pages/pk/room";
import Reward from "@/pages/pk/reward";
import Game from "@/pages/pk/game";

import NftSell from "@/pages/nft/sell";
import NftStore from "@/pages/nft/store";
import NftDetail from "@/pages/nft/detail";

import List from "@/pages/list";
import Demo from "@/pages/demo";

const routes = createBrowserRouter([
  {
    path: "/",
    Component: Main,
    children: [
      {
        path: "",
        element: <Navigate to="/home" replace />,
      },
      {
        path: "home",
        Component: Home,
      },
      {
        path: "earn",
        Component: Earn,
      },
      {
        path: "pk",
        Component: Pk,
      },
      {
        path: "task",
        Component: Task,
      },
      {
        path: "nft",
        Component: Nft,
      }
    ]
  },
  {
    path: "earn",
    Component: Layout,
    children: [
      {
        path: "record",
        Component: EarnRecord,
      },
    ],
  },
  {
    path: "pk",
    Component: Layout,
    children: [
      {
        path: "room",
        Component: PkRoom,
      },
      {
        path: "reward",
        Component: Reward,
      },
      {
        path: "game",
        Component: Game,
      }
    ],
  },
  {
    path: "nft",
    Component: Layout,
    children: [
      {
        path: "sell",
        Component: NftSell,
      },
      {
        path: "store",
        Component: NftStore,
      },
      {
        path: "detail/:id",
        Component: NftDetail
      }
    ],
  },
  {
    path: "list",
    Component: List,
  },
  {
    path: "demo",
    Component: Demo,
  },
]);
export default routes;
